package jmcnet.libcommun.communs.enum {
	import flash.utils.Dictionary;
	
	import jmcnet.libcommun.communs.enum.EnumBase;
	import jmcnet.libcommun.communs.exceptions.ErrorIllegalEnumValue;
	
	import mx.collections.ArrayCollection;

	public class EnumConditionFiltreDate extends EnumBase
	{
		/**
	     * Les valeurs possibles 
	     */
    	public static const TYPE_Superieur:EnumConditionFiltreDate = new EnumConditionFiltreDate(">");
		public static const TYPE_Egal:EnumConditionFiltreDate = new EnumConditionFiltreDate("=");
		public static const TYPE_Inferieur:EnumConditionFiltreDate = new EnumConditionFiltreDate("<");
	    
   	    public static function init():Boolean {
			addPossibleValue("TYPE_Superieur",TYPE_Superieur );
			addPossibleValue("TYPE_Egal",TYPE_Egal );
			addPossibleValue("TYPE_Inferieur",TYPE_Inferieur );
			return true;
		}
		
		public function EnumConditionFiltreDate(value:String) {
			super(value);
		}
		
		/**********************************************************************************************************************
		 * Partie commune a tous les Enum
		 */
   	    private static var _values:Dictionary = new Dictionary();
	    private static var _literals:ArrayCollection = new ArrayCollection();
	    private static var _names:ArrayCollection = new ArrayCollection();
	    private static var _valueList:ArrayCollection = new ArrayCollection();
	    
  		static private const res:Boolean = init();
	    
	    /**
	     * Ajoute une valeur possible a cet �num�r� 
	     */
	    public static function addPossibleValue(name:String, possibility:EnumBase):void {
	    	_values[possibility.value] = possibility;
	    	_valueList.addItem(possibility);
	    	_literals.addItem(possibility.value);
	    	_names.addItem(name);
	    }
	
	    public static function fromString(value:String):EnumConditionFiltreDate {
	        var typeValue:EnumConditionFiltreDate = _values[value];
	        if (typeValue == null)
	        {
	            throw new ErrorIllegalEnumValue("invalid value '" + value + "', possible values are: " + _literals);
	        }
	        return typeValue;
	    }
	    
	    public static function literals():ArrayCollection { return _literals; }
	    public static function names():ArrayCollection { return _names; }	    
	    public static function values():ArrayCollection  { return _valueList; }
	    public static function literalsExtended(firstChoice:String):ArrayCollection {
			var ret:ArrayCollection = new ArrayCollection();
			ret.addItem(firstChoice);
			ret.addAll(_literals);
			return ret;
		}
	}
}